﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace XGameFrame.Graphic
{
    /// <summary>
    /// moebis:
    /// Class for Mouse animations
    /// </summary>
    public class AnimatedMouseSprite:AnimatedSpriteBase
    {
        #region Fields Region
        #endregion

        #region Property Region
        #endregion

        #region Constructor
        /// <summary>
        /// Constructor for a new AnimatedMouseSprite with Animation
        /// </summary>
        /// <param name="pTexture">The Graphic to draw</param>
        /// <param name="pRows">The number of rows</param>
        /// <param name="pColumns">The number of columns</param>
        /// <param name="pPosition">The rectangle around the graphic</param>
        public AnimatedMouseSprite(Texture2D pTexture, int pRows, int pColumns, Vector2 pPosition)
            : base(pTexture, pRows, pColumns, pPosition)
        {
        }

        #endregion

        #region Abstract Method Region
        /// <summary>
        /// Do Logic for AnimatedSprites
        /// </summary>
        public override void Update(GameTime pGameTime)
        {
            this.Position = new Vector2(InputHandler.CurrentMouseState.X - (Size.X / 2), InputHandler.CurrentMouseState.Y - (Size.Y / 2));

            Bounds = new Rectangle((int)Position.X,
            (int)Position.Y,
            (int)FrameSize.X,
            (int)FrameSize.Y);
            SourceRectangle = new Rectangle(
            (int)FrameSize.X * CurrentCulumn,
            (int)FrameSize.Y * CurrentRow,
            (int)FrameSize.X,
            (int)FrameSize.Y);
            DestRectangle = new Rectangle((int)Position.X,
                (int)Position.Y,
                (int)FrameSize.X,
                (int)FrameSize.Y);
            base.Update(pGameTime);
        }

        /// <summary>
        /// Do drawings for AnimatedSprites
        /// </summary>
        /// <param name="pSpriteBatch">The graphic to draw</param>
        /// <param name="pLocation">The location where it's have to draw</param>
        public override void Draw(SpriteBatch pSpriteBatch)
        {
            pSpriteBatch.Draw(Texture, Position, SourceRectangle, Color.White, Rotation, Origin,Scale, SpriteEffect, LayerDepth);
        }

        public override void OnHover(PlayerIndex pPlayerIndex){}
        public override void HandleInput(PlayerIndex pPlayerIndex){}

        #endregion
    }
}
